package com.mixsmart.commonweb.bean.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.mixsmart.commonweb.bean.ICreateTime;
import com.mixsmart.commonweb.bean.IPKStringBean;
import com.mixsmart.core.log.ILogBean;
import com.mixsmart.enums.YesNoType;

/**
 * 登录日志
 * @author lmq
 * @version 1.0
 * @since JDK版本大于等于1.6
 * 2016年2月1日
 */
@Entity
@Table(name="t_c_login_log")
public class TCLoginLog implements IPKStringBean, ICreateTime, ILogBean {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -8434827088812507835L;

	private String id;
	
	private String username;
	
	private String ip;
	
	/**
	 * 是否登录成功
	 * 1--成功
	 * 0--失败
	 */
	private Integer state = YesNoType.NO.getIndex();
	
	private String msg;
	
	private String userAgent;
	
	private Date createTime;
	
	/**
	 * 用户登录类型
	 * mobile--移动手机端
	 * pc -- 电脑端
	 */
	private String loginType;

	
	//////getter and setter//////
	
	@Id
	@Column(name="id", length=50)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name="username", length=127, nullable=false)
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Column(name="ip", length=127, nullable=false)
	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	@Column(name="state", nullable=false)
	public Integer getState() {
		return state;
	}

	public void setState(Integer state) {
		this.state = state;
	}

	@Column(name="msg", length=500)
	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	@Column(name="user_agent", length=2000)
	public String getUserAgent() {
		return userAgent;
	}

	public void setUserAgent(String userAgent) {
		this.userAgent = userAgent;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="create_time")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name="login_type", length=255)
	public String getLoginType() {
		return loginType;
	}

	public void setLoginType(String loginType) {
		this.loginType = loginType;
	}

}
